export function useWebsocket(handleMessage: any) {
  const ws = new WebSocket('');
  const init = () => {
    bindEvent();
  };

  const bindEvent = () => {
    ws.addEventListener('open', handleOpen, false);
    ws.addEventListener('open', handleClose, false);
    ws.addEventListener('open', handleError, false);
    ws.addEventListener('open', handleMessage, false);
  };

  function handleOpen(e: any) {
    console.log('Websocket--open');
  }
  function handleClose(e: any) {
    console.log('Websocket--close');
  }
  function handleError(e: any) {
    console.log('Websocket--error');
  }
}
